package com.ch.web.mq;

import java.io.Serializable;

/**
 * 回调队列存储的message
 */
public class ResultMessage implements Serializable, Comparable<ResultMessage> {

    private static final long serialVersionUID = 7873696788052162996L;
    private MessageRegister register;
    private String msg;

    public ResultMessage() {
    }

    private ResultMessage(MessageRegister register) {
        this.register = register;
        this.msg="success";

    }

    private ResultMessage(MessageRegister register, String msg) {
        this.register = register;
        this.msg = msg;
    }

    public static ResultMessage failCreate(MessageRegister register, String msg) {
        return new ResultMessage(register, msg);
    }

    public static ResultMessage successCreate(MessageRegister register, String msg) {
        return new ResultMessage(register, msg);
    }
    public MessageRegister getRegister() {
        return register;
    }

    public void setRegister(MessageRegister register) {
        this.register = register;
    }



    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public int compareTo(ResultMessage o) {
        return this.getRegister().getId().compareTo(o.getRegister().getId());
    }
}
